import numpy as np

from utils import Log, pack_metric_fun, MatrixLog
from sklearn.metrics import mean_absolute_percentage_error, r2_score

y_true = np.array([0.1, 0.5, 1, 4, 6])
y_pred = np.array([0.12, 0.53, 1.4, 4.1, 5.8])


@Log(False)
def mae(true_val, pred_val):
    funes = pack_metric_fun(mean_absolute_percentage_error, r2=r2_score)
    res = dict()

    for key in funes:
        res[key] = funes[key](true_val, pred_val)

    return res


val = mae(y_true, y_pred)

logs = MatrixLog(mean_absolute_percentage_error, r2=r2_score)

vals = logs(y_true, y_pred, True)
